package com.taxi.controller;

import com.taxi.dto.DriverUser;
import com.taxi.result.Result;
import com.taxi.service.DriverUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: aniu
 * @Date: 2023/9/27
 * @ClassName: DriverUserController
 * @Description: Write class functionality and purpose here.
 * @Version: 1.0
 */
@RestController
public class DriverUserController {
    @Autowired
    private DriverUserService driverUserService;

    /**
     * 添加司机Or修改司机
     * @param driverUser
     * @return
     */
    @PostMapping("/driver-user")
    public Result addDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.addDriverUser(driverUser);
    }

    /**
     * 查询所有司机
     * @param
     * @return
     */
    @GetMapping("/driver-user/list")
    public Result getDriverUserList(@RequestParam int page, @RequestParam int limit, @RequestParam(required = false) String address, @RequestParam(required = false) String phone){
        return driverUserService.getDriverUserList(page, limit, address, phone);
    }
}
